package com.xm.hiber;


import com.xm.hiber.dao.InstructorDao;
import com.xm.hiber.dao.InstructorDetailDao;
import com.xm.hiber.entity.Instructor;
import com.xm.hiber.entity.InstructorDetail;


public class App {
    public static void main(String[] args) {

        Instructor instructor = new Instructor("Ramesh", "Fadatare", "ramesh@javaguides.com");

        InstructorDetail instructorDetail = new InstructorDetail("http://www.youtube.com", "Guitar");
        // associate the objects
        instructorDetail.setInstructor(instructor);
        // associate the objects
        instructor.setInstructorDetail(instructorDetail);

        // when you get instructorDetail then hibernate also saves instructor info
        InstructorDao instructorDao = new InstructorDao();
        instructorDao.saveInstructor(instructor);
        System.out.println(instructorDao.getInstructor(1));
        System.out.println("--------------");
        InstructorDetailDao instructorDetailDao = new InstructorDetailDao();
        System.out.println(instructorDetailDao.getInstructorDetail(1));
    }
}
